﻿using DocumentFormat.OpenXml;
using DocumentFormat.OpenXml.Wordprocessing;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DataService.Office.Word
{
    public static class XmlParagraph
    {
        public static Paragraph ParagraphAfterXmlElement(Body docBody, OpenXmlElement element)
        {
            return docBody.InsertAfter<Paragraph>(new Paragraph(), element);
        }
        public static string GetParagraphText(OpenXmlElement openXmlElement)
        {
            var textList = openXmlElement.Descendants<Text>().ToList();
            var textValueList = textList.Select(x => x.InnerText);
            return string.Join("", textValueList);
        }
    }
}
